<?php  

/** 
* Member Page (Controller) 
* Страница участника (контроллер) 
* @author IT studio IRBIS-team 
* @copyright © 2009 IRBIS-team 
*/
/////////////////////////////////////////////////////////

/**
* Generation of page of an error at access out of system
* Генерация страницы ошибки при доступе вне системы
*/
    if(!defined('IRB_KEY'))
    {
       header("HTTP/1.1 404 Not Found");      
       exit(file_get_contents('../../404.html'));
    } 
//////////////////////////////////////////////////////////
	$GET['id'] = !empty($GET['id'])?htmlChars($GET['id']):'';
	
/**
* We connect a file of the MySQL functions
* Подключаем файл функций MySQL
*/  
   include './libs/mysql.php'; 

	if(!empty($GET['id']))
	{
	$res = mysqlQuery("SELECT u.*,cy.name as country,r.name as region,ct.name as city
				FROM  `". IRB_DBPREFIX ."user` u
				LEFT JOIN `country` cy ON (cy.country_id = u.country)
				LEFT JOIN `region` r ON (r.region_id = u.region)
				LEFT JOIN `city` ct ON (ct.city_id = u.city)
			WHERE u.id =".$GET['id']."");
	$res_a = mysqlQuery("SELECT *
		                   FROM  `". IRB_DBPREFIX ."assets` WHERE owner=".$GET['id']."");
	$res_r = mysqlQuery("SELECT *
		                   FROM  `". IRB_DBPREFIX ."requests` WHERE owner=".$GET['id']."");

	if(mysql_num_rows($res) > 0)
		{
		$m = htmlChars(mysql_fetch_assoc($res));
		if(empty($m['photo']))
				$m['photo'] = 'http://socdomen.ru/skins/images/no.photo.gif';
		if(mysql_num_rows($res_a) > 0)
			{
				while ($row = mysql_fetch_assoc($res_a)) 
				$m_a[] = htmlChars($row);
			}
		if(mysql_num_rows($res_r) > 0)
			{
				while ($row_r = mysql_fetch_assoc($res_r)) 
				$m_r[] = htmlChars($row_r);
			}
		}
	}
	else
	 reDirect('page=members', 'rem=read');
	

